<template>
  <div>
    <div class="text" v-if="properties.actionerRules && properties.actionerRules.length">
      <div v-for="(obj, i) in properties.actionerRules" :key="i">
        抄送：
        <template v-if="obj.type === 1">
          <a v-for="(a, j) in obj.actioners" :key="a.id">
            {{ a.name }}
            <template v-if="j != obj.actioners.length - 1">,</template>
          </a>
        </template>
        <template v-if="obj.type === 5"
          >抄送人为{{ userInputName(obj.userInputId) }} - 人员选择器
        </template>
      </div>
    </div>
    <div v-else class="text">发起人自选</div>
  </div>
</template>

<script setup lang="ts">
import type { Properties } from '../../types'
const props = defineProps({
  properties: {
    type: Object as () => Properties,
    default: () => {
      return {
        approvalNone: 1,
        actionerRules: []
      }
    }
  }
})
const userInputList = ref([
  {
    key: '', // 表单项key
    title: '' // 表单项名称
  }
])
const userInputName = (id: string) => {
  const input = userInputList.value.find((el) => el.key === id)
  return input ? input.title : ''
}
watch(props, () => {
  console.log(props)
})
</script>
